<?php #20070906 http://www.framework.altervista.org/FrameWork/libs/al_07_libGraphics.inc
/************************************************************************/
/* FrameWork  test preview                                              */
/* ==================================================================== */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/*                                                                      */
/* libGraphics.inc utility varie per l'aspetto dei blocchi e delle 	*/
/* applicazioni                                                         */
/************************************************************************/

?>

<!--[if lt IE 7]>
<script language="JavaScript">
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters))
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }
}
window.attachEvent("onload", correctPNG);
</script>
<![endif]-->

<?php
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

function createTitle($name,$icon,$iconpath) {
	$path = "themes/".theme()."/images/titleicon.png";
	if(file_exists("$iconpath/images/titleicon.png")) $path = "$iconpath/images/titleicon.png";
	if(file_exists("$iconpath/images/titleicon.gif")) $path = "$iconpath/images/titleicon.gif";
	if(file_exists("$iconpath.png")) $path = "$iconpath.png";
#	if($iconpath=="") $path = "themes/".theme()."/images/titleicon.png";
#	else $path = $iconpath;

	echo "<h3 class='titlebar'>
			<img class=\"titleicon $icon\" src=\"$path\" alt=\"$icon\" >
			<span class='titletext'>$name</span>
	</h3>";
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

//crea il link a fckeditor x i blocchi
function edit_block_link($path,$block){
$tema=theme();
    if ((defined('LIBGROUP') && group_getusergroup("webmaster",user_getuser())) || admin_isadmin()){
	echo"<h3 class='edit'><a href='index.php?appname=_block_editor.inc&appdest=$path/$block/block.inc&file=datas/$path/$block/pagina'><img src='themes/$tema/images/edit.gif' alt='Edit' border='0'</a></h3>";
    }
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

//crea il link a fckeditor
function edit_link($path,$apptitle){
$tema=theme();
    if ((defined('LIBGROUP') && group_getusergroup("webmaster",user_getuser())) || admin_isadmin()){
	echo"<a href=\"".ahah_link("index.php?appname=_editor.inc&appdest=".$_GET['appname']."&file=datas/$path/$apptitle/pagina",$path,"center")."\"><img src='themes/$tema/images/edit.gif' alt='Edit' border='0'</a>";
    }
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

//crea il link a code editor
function edit_code_link($filename){
$tema=theme();
    if (admin_isadmin()){
	echo "<a href=\"index.php?appname=_codepress.inc&file=$filename\"><img src='themes/$tema/images/c.gif' alt='Code' border='0'</a>";
    }
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

//crea il link alla stampa in html x applicazioni
function print_html_app($appname){
$tema=theme();
    echo "<a href='index.php?appname=$appname&print_op=printapp'><img src='themes/$tema/images/print.png' alt='Print to HTML' border='0'></a>";
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//crea il link alla stampa in html x applicazioni
function print_pdf_app($appname){
$tema=theme();
    echo "<a href='index.php?appname=$appname&print_op=printappdf'><img src='themes/$tema/images/pdf.png' alt='Print to PDF' border='0'></a>";
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

// Funzione ToolBar_Footer per applicazioni varie
function toolbar($path,$apptitle,$filename,$appname) {
    echo "<h3 class='edit'>";
    edit_link($path,$apptitle);
    edit_code_link($path."/".$appname."/application.inc");
    print_html_app($appname);
    print_pdf_app($appname);
    echo "</h3>";
}


//----------------------------------------------------------------------------------------------------------------------

function zoom() {
/* comando blocchi  laterali a scoparsa */
if (defined('LIBUSER')&& user_getuser()){
    if ($_GET['zoom']=="on")
	user_setkey(user_getuser(),"user_zoom","on");
    if ($_GET['zoom']=="off")
	user_setkey(user_getuser(),"user_zoom","off");
}
?>

<script type='text/javascript'>
//igrandisce al massimo l'area applicazione
function ingrandisci (){
    if(document.getElementById('left').style.display !='none'){
	document.getElementById('left').style.display='none';
	document.getElementById('right').style.display='none';
	document.getElementById('center').style.marginLeft='0';
	document.getElementById('center').style.marginRight='0';
	document.getElementById('top').style.display='none';
	document.getElementById('bottom').style.display='none';

	ahah("index.php?ahah=1&path=blocks/top&block=00_zoom.inc&zoom=on", 'zoom', 0, 'POST', "");
    }
    else{
	document.getElementById('left').style.display='inline';
	document.getElementById('right').style.display='inline';
	document.getElementById('center').style.marginLeft=document.getElementById('left').style.width;
	document.getElementById('center').style.marginRight=document.getElementById('right').style.width;
	document.getElementById('top').style.display='inline';
	document.getElementById('bottom').style.display='inline';

	ahah("index.php?ahah=1&path=blocks/top&block=00_zoom.inc&zoom=off", 'zoom', 0, 'POST', "");
    }
}
</script>
<?php if ($_GET['ahah']!=1) { ?>
    <div id='zoom' >
<?php } ?>

<p align="right">

<?php
if(admin_isadmin()){
    if (appname()!=""){
	$param="&appname=".appname();
    }
?>
<?php } ?>

<?php    if(defined('LIBUSER')&& user_getuser() && user_getkey(user_getuser(),"user_zoom")=="on")echo"<script type='text/javascript'>id=window.setTimeout(\"ingrandisci();\",1000);</script>";?>
<input type='button' value='Zoom <?php if (defined('LIBUSER')&& user_getuser())echo "(".user_getkey(user_getuser(),"user_zoom").")";?>' onclick="javascript:ingrandisci();" style="font-size:8px;" />


<? } ?>

<?
//----------------------------------------------------------------------------------------------------------------------

?>
